package com.bluemsun.naturallanguageprocessing.controller;

import com.bluemsun.naturallanguageprocessing.common.ServerResponse;
import com.bluemsun.naturallanguageprocessing.service.IUserTagService;
import com.bluemsun.naturallanguageprocessing.service.impl.UserTagServiceImpl;
import com.bluemsun.naturallanguageprocessing.vo.ListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author ：hj
 * @date ：Created in 2021/4/25 18:11
 * @description：用户选择标签
 * @modified By：
 * @version: $
 */
@RestController
@RequestMapping("/usertag/")
public class UserTagController {

    @Autowired
    IUserTagService userTagService;

    @GetMapping("tag")
    @ResponseBody
    public ServerResponse getTag(){
        return userTagService.getTag();
    }

    @PostMapping("select")
    @ResponseBody
    public ServerResponse selectTag(HttpServletRequest request,@RequestBody ListVO listVO){
        if(listVO.getList().size()==0){
            return ServerResponse.createByErrorMessage("数组不能为空");
        }
        return userTagService.insertSelect(request,listVO.getList());
    }

    @GetMapping("get")
    @ResponseBody
    public ServerResponse getUserTag(HttpServletRequest request){
        return  userTagService.getUserTag(request);
    }

    @PostMapping("update")
    @ResponseBody
    public ServerResponse update(HttpServletRequest request,@RequestBody ListVO listVO){
        return  userTagService.updateUserTag(request,listVO.getList());
    }

    @GetMapping("isSelect")
    @ResponseBody
    public ServerResponse isSelect(HttpServletRequest request){
        return userTagService.isSelect(request);
    }

}
